#ifndef CELLS_BASE_HPP
#define CELLS_BASE_HPP


#include "crtpBase.hpp"
#include "meshTypes_fwd.hpp"
#include <experimental/memory>

namespace hms
{

/* this is not a forward declaration, but rather the full definition of the
 * unspecialised traits class. Each edges implementation has to specialise it.
 * */
/**
 * @brief Traits class to hold information on types used by the edges class
 * 
 * @tparam MeshType 
 */
template<typename CellsType>
class CellsTraits{};

template<class CellsType>
class CellsBase : public CrtpBase<CellsType>
{
public:
	using Traits = CellsTraits<CellsType>;
	using MeshType = typename Traits::MeshType;
	using AreasReturnType     = typename Traits::AreasReturnType;
	using CircumfsReturnType  = typename Traits::CircumfsReturnType;
	using CentroidsReturnType = typename Traits::CentroidsReturnType;

protected:
	std::experimental::observer_ptr<const MeshType> m_mesh {nullptr};

public:
	auto mesh() const -> const MeshType&;
	void mesh( const MeshType& );

	auto areas    () const -> AreasReturnType;
	auto circumfs () const -> CircumfsReturnType;
	auto centroids() const -> CentroidsReturnType;

protected:
	CellsBase() = default;
	CellsBase( const MeshType& );
};

} // namespace hms

#include "cellsBase.tpp"

#endif